<?php

class user_alter {
	public function delete($user_id,$oa){
	
		if(!empty($user_id)) {
			foreach($user_id as $value) {
				$strsql = "DELETE FROM  login_user WHERE uid = ".$value;
				//echo $strsql.'<br>';
				$row=$oa->query($strsql);
				if($row){
					echo  "<script>alert('删除成功!'); window.location.href='user_list.php';</script>";
				}
			}
		}
	}
	 public function update($oa,$user_id,$user_name,$user_pwd,$prv_flag){
	 		
	 			$get_user_acc = "select * from login_user where user_acc='$user_acc'";
	 			$get_result = $oa->query($get_user_acc);
	 			$get_nums = mysql_num_rows($get_result);
	 			//echo  $get_nums;
	 			if($get_nums == 0){
	 				//echo $user_id;
	 				$upsql="UPDATE login_user SET username='$user_name' ,user_pwd='$user_pwd' ,prv_flag='$prv_flag'  WHERE uid=".$user_id;
	 				
	 				if($get_row=$oa->query($upsql)){
	 					echo  "<script>alert('修改成功!'); window.location.href='user_list.php';</script>";
	 				}
	 				
	 				
	 			}
	 			else{
	 			
	 				echo "<script> alert('存在该用户请修改成其它帐号!');window.history.back();</script>";
	 			   }
	 		}
	
}
?>